<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组的find方法</title>
    <script>
        let arr = [1, 2, 3, 4, 5, 6, 8, 9, 7, 10];
        //find依旧会便利数组，element表示当前的元素
        //箭头函数的内容表示筛选的规则，如果true就返回当前的元素
        let find = arr.find(element => element === 8);
        console.log(find);

        let users = [{
            id: 10086,
            name: "ldh",
            age: 50
        }, {
            id: 10010,
            name: "ldh",
            age: 51
        }, {
            id: 10000,
            name: "ldh",
            age: 52
        }];

        let result = users.find(user => user.id === 10010);
        console.log(result);
    </script>
</head>
<body>

</body>
</html>